﻿using System.Globalization;
using System.Windows.Controls;

namespace Helpers.Validation
{
    public class ValidString : ValidationRule
    {

        private int minLength = 0;
        public int MinLength
        {
            get { return minLength; }
            set { minLength = value; }
        }

        public ValidString()
        {
        }

        public override ValidationResult Validate(object value, CultureInfo cultureInfo)
        {
            string val = (string)value;
            if (val.Length < minLength)
            {
                return new ValidationResult(false,
                  "Please enter a valid value with at least " + minLength + " characters.");
            }
            else
            {
                return new ValidationResult(true, null); 
            }
        }

    }
}
